<template>
  <div class="app-container">
    <el-card class="box-card">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true"  >
      <!-- 第一行-->





      <el-form-item label="证件编号" prop="certificateId">
        <el-input
          v-model="queryParams.certificateId"
          placeholder="请输入证件编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>



      <el-form-item label="身份证号" prop="idNumber">
        <el-input
          v-model="queryParams.idNumber"
          placeholder="请输入身份证号"
          clearable
          maxlength="18"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="姓名" prop="username" label-width="68px">
        <el-input
          v-model="queryParams.username"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

<!--      <el-form-item label="部门" prop="deptid">-->
<!--        <el-input-->
<!--          v-model="queryParams.deptid"-->
<!--          placeholder="请输入部门"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->


      <!-- 第2行-->


      <el-form-item label="单位" prop="department" v-show="showSearch" label-width="68px">
        <el-input
          v-model="queryParams.department"
          placeholder="请输入单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>



      <el-form-item label="承办人" prop="undertaker" v-show="showSearch" label-width="68px">
        <el-input
          v-model="queryParams.undertaker"
          placeholder="请输入承办人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>



      <el-form-item label="电话" prop="phone" v-show="showSearch" label-width="68px">
        <el-input
          v-model="queryParams.phone"
          placeholder="请输入电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>



      <el-form-item label="来源" prop="equipSource" v-show="showSearch" label-width="68px">
        <el-input
          v-model="queryParams.equipSource"
          placeholder="请输入来源"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>


      <!-- 第3行-->

      <el-form-item label="编号" prop="serialNumber" v-show="showSearch" label-width="68px">
        <el-input
          v-model="queryParams.serialNumber"
          placeholder="请输入编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>



      <el-form-item label="硬件编码" prop="hardwareCode" v-show="showSearch">
        <el-input
          v-model="queryParams.hardwareCode"
          placeholder="请输入硬件编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>



<!--      <el-form-item label="硬盘序列号" prop="identificationOfHardDisk" v-show="showSearch">-->
<!--        <el-input-->
<!--          v-model="queryParams.identificationOfHardDisk"-->
<!--          placeholder="请输入硬盘序列号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->



<!--      <el-form-item label="类型" prop="sequenceNumber" v-show="showSearch">-->
<!--        <el-input-->
<!--          v-model="queryParams.equipType"-->
<!--          placeholder="请输入类型"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->



      <div style="text-align: right;margin-right:-9px;">
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
      </div>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:archives:add']"
        >新增</el-button>
      </el-col>



      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:archives:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport"
          v-hasPermi="['system:archives:import']"
        >导入</el-button>

      </el-col>

      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:archives:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="archivesList" border @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" :index="indexMethod" type="index" width="50"/>
      <el-table-column label="姓名" align="center" prop="username" v-if="columns[0].visible"/>
      <el-table-column label="证件编号" align="center" prop="certificateId" v-if="columns[1].visible"/>
      <el-table-column label="身份证号" align="center" prop="idNumber" v-if="columns[2].visible"/>
      <el-table-column label="部门" align="center" prop="deptid" v-if="columns[3].visible">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.yh_deptid" :value="scope.row.deptid"/>
        </template>
      </el-table-column>
      <el-table-column label="单位" align="center" prop="department" v-if="columns[4].visible"/>
      <el-table-column label="承办人" align="center" prop="undertaker" v-if="columns[5].visible"/>
      <el-table-column label="电话" align="center" prop="phone" v-if="columns[6].visible"/>
      <el-table-column label="类型" align="center" prop="equipType" v-if="columns[7].visible"/>
      <el-table-column label="来源" align="center" prop="equipSource" v-if="columns[8].visible"/>
      <el-table-column label="编号" align="center" prop="serialNumber" v-if="columns[9].visible"/>
      <el-table-column label="M级" align="center" prop="equipSecurity" v-if="columns[10].visible">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.yh_security" :value="scope.row.equipSecurity"/>
        </template>
      </el-table-column>
      <el-table-column label="启用时间" align="center" prop="activeTime" v-if="columns[11].visible"/>
      <el-table-column label="品牌类型" align="center" prop="brandType" v-if="columns[12].visible"/>
      <el-table-column label="硬件编码" align="center" prop="hardwareCode" v-if="columns[13].visible"/>
      <el-table-column label="硬盘序列号" align="center" prop="identificationOfHardDisk" v-if="columns[14].visible"/>
      <el-table-column label="安全BM防护系统安装情况" align="center" prop="installation" v-if="columns[15].visible"/>
      <el-table-column label="主要通途" align="center" prop="mainThoroughfare" v-if="columns[16].visible"/>
      <el-table-column label="品牌类型" align="center" prop="brandType" v-if="columns[17].visible"/>
      <el-table-column label="类型" align="center" prop="equipType" v-if="columns[18].visible"/>
      <el-table-column label="责任人" align="center" prop="dutyOfficer" v-if="columns[19].visible"/>
      <el-table-column label="责任开始时间" align="center" prop="dutyStartTime" width="180" v-if="columns[20].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.dutyStartTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>

      <el-table-column label="责任结束时间" align="center" prop="dutyEndTime" width="180" v-if="columns[43].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.dutyEndTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审批领导(责任人变更登记)" align="center" prop="changeLeadership" v-if="columns[21].visible"/>
      <el-table-column label="日期" align="center" prop="changeDate" width="180" v-if="columns[22].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.changeDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="故障原因" align="center" prop="faultCause" v-if="columns[23].visible"/>
      <el-table-column label="报修人" align="center" prop="repairMan" v-if="columns[24].visible"/>
      <el-table-column label="处理结果" align="center" prop="handlingResult" v-if="columns[25].visible"/>
      <el-table-column label="经办人" align="center" prop="operator" width="180" v-if="columns[26].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.operator, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审批领导(故障维修登记)" align="center" prop="maintainLeadership" v-if="columns[27].visible"/>
      <el-table-column label="报废原因" align="center" prop="discardReason" v-if="columns[28].visible"/>
      <el-table-column label="报废日期" align="center" prop="retirementTime" width="180" v-if="columns[29].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.retirementTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="责任人意见" align="center" prop="dutyOfficerOpinion" v-if="columns[30].visible"/>
      <el-table-column label="审批领导建议" align="center" prop="leadershipSuggestions" v-if="columns[31].visible"/>
      <el-table-column label="存放地点" align="center" prop="storagePlace" v-if="columns[32].visible"/>
      <el-table-column label="管理人" align="center" prop="custodian" v-if="columns[33].visible"/>
      <el-table-column label="送销地点" align="center" prop="sendLocation" v-if="columns[34].visible"/>
      <el-table-column label="送销日期" align="center" prop="sendDate" width="180" v-if="columns[35].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.sendDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="送销人" align="center" prop="sendPeople" v-if="columns[36].visible"/>
      <el-table-column label="监销人" align="center" prop="salePeople" v-if="columns[37].visible"/>
      <el-table-column label="创建者" align="center" prop="createBy" v-if="columns[38].visible" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180" v-if="columns[39].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新者" align="center" prop="updateBy" v-if="columns[40].visible"/>
      <el-table-column label="更新时间" align="center" prop="updateTime" width="180" v-if="columns[41].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark" v-if="columns[42].visible"/>





      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"

            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:archives:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"

            @click="handleDelete(scope.row)"
            v-hasPermi="['system:archives:remove']"
          >删除</el-button>
          <el-button
            size="mini"
            type="text"

            @click="handleView(scope.row,scope.index)"
            v-hasPermi="['system:archives:query']"
          >详细</el-button>


        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />


    </el-card>

    <!--导入 -->
    <!-- 用户导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px">
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的办公设备数据
          </div>
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="danger" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>




    <!-- 添加或修改办公设备对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1300px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">个人基本信息</p>
            </el-divider>
            </el-header>
          <el-main>
            <!--第一行-->
            <el-row>
              <el-col :span="8">
        <el-form-item label="姓名" prop="username" label-width="30%">
<!--          <el-input v-model="form.username" placeholder="请输入姓名" style="width:90%;float:left"/>-->
          <el-autocomplete
            style="width:90%;float:left"
            placeholder="请输入姓名"
            v-model="form.username"
            :fetch-suggestions="querySearchAsync"
            @select="handleSelect"
          >
          </el-autocomplete>
        </el-form-item>
              </el-col>
              <el-col :span="8">
        <el-form-item label="证件编号" prop="certificateId" label-width="30%">
          <el-input v-model="form.certificateId"
                    placeholder="请输入证件编号" style="width:90%;float:left"/>

        </el-form-item>
              </el-col>
                <el-col :span="8">
        <el-form-item label="身份证号" prop="idNumber" label-width="30%">
         <el-input v-model="form.idNumber" maxlength="18" placeholder="请输入身份证号" style="width:90%;float:left"/>


        </el-form-item>
              </el-col>
            </el-row>

            <!--第2行-->
            <el-row>
              <el-col :span="8">
        <el-form-item label="部门" prop="deptid" label-width="30%">
<!--          <el-input v-model="form.deptid" placeholder="请输入部门" />-->
          <el-select v-model="form.deptid" placeholder="请选择部门" style="width:90%;float:left">
            <el-option
              v-for="dict in dict.type.yh_deptid"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
<!--          <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择部门" style="width:90%;float:left"/>-->
        </el-form-item>
              </el-col>

              <el-col :span="8">
        <el-form-item label="单位" prop="department" label-width="30%">
          <el-input v-model="form.department" placeholder="请输入单位" style="width:90%;float:left"/>
        </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="电话" prop="phone" label-width="30%">
                  <el-input v-model="form.phone" placeholder="请输入电话" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

            </el-row>


          </el-main>
        </el-container>

        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">设备基本信息</p>
            </el-divider>
          </el-header>
          <el-main>


            <!--第3行-->
            <el-row>


              <el-col :span="8">
                <el-form-item label="类型" prop="equipType" label-width="30%">
                  <el-input v-model="form.equipType" placeholder="请输入类型" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="来源" prop="equipSource" label-width="30%">
                  <el-input v-model="form.equipSource" placeholder="请输入来源" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="编号" prop="serialNumber" label-width="30%">
                  <el-input v-model="form.serialNumber" placeholder="请输入编号" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>
            </el-row>
            <!--第4行-->
            <el-row>
              <el-col :span="8">
        <el-form-item label="M级" prop="equipSecurity" label-width="30%">
          <el-select v-model="form.equipSecurity" placeholder="请选择菜单" style="width:90%;float:left" clearable>
            <el-option
              v-for="dict in dict.type.yh_security"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
              </el-col>

              <el-col :span="8">
        <el-form-item label="启用时间" prop="activeTime" label-width="30%">
          <el-date-picker clearable
                          v-model="form.activeTime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择启用时间"
                          style="width:90%;float:left">
          </el-date-picker>
        </el-form-item>
              </el-col>

              <el-col :span="8">
        <el-form-item label="硬件编码" prop="hardwareCode" label-width="30%">
          <el-input v-model="form.hardwareCode" placeholder="请输入硬件编码" style="width:90%;float:left"/>
        </el-form-item>
              </el-col>
            </el-row>

            <!--第5行-->
            <el-row>
              <el-col :span="8">
        <el-form-item label="硬盘序列号" prop="identificationOfHardDisk" label-width="30%">
          <el-input v-model="form.identificationOfHardDisk" placeholder="请输入硬盘序列号" style="width:90%;float:left"/>
        </el-form-item>
              </el-col>

              <el-col :span="8">
        <el-form-item label="BM防护系统情况" prop="installation" label-width="30%">
          <el-input v-model="form.installation" placeholder="请输入安全BM防护系统安装情况" style="width:90%;float:left"/>
        </el-form-item>
              </el-col>

              <el-col :span="8">
        <el-form-item label="主要通途" prop="mainThoroughfare" label-width="30%">
          <el-input v-model="form.mainThoroughfare" placeholder="请输入主要通途" style="width:90%;float:left"/>
        </el-form-item>
              </el-col>
            </el-row>

            <!--第6行-->
            <el-row>

              <el-col :span="8">
                <el-form-item label="承办人" prop="undertaker" label-width="30%">
                  <el-input v-model="form.undertaker" placeholder="请输入承办人" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>


              <el-col :span="8">
                <el-form-item label="日期" prop="changeDate" label-width="30%">
                  <el-date-picker clearable
                                  v-model="form.changeDate"
                                  type="date"
                                  value-format="yyyy-MM-dd"
                                  placeholder="请选择日期"
                                  style="width:90%;float:left">
                  </el-date-picker>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="品牌类型" prop="note" label-width="30%">
                  <el-input v-model="form.brandType" placeholder="请输入品牌类型" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>


            </el-row>


            <el-row>
              <el-col :span="24">
                <el-form-item label="备注" prop="remark" label-width="10%">
                  <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" style="width:97.5%;float:left"/>
                </el-form-item>
              </el-col>
            </el-row>
          </el-main>
        </el-container>

      <el-container>
        <el-header>
          <el-divider content-position="left">
            <p style="color: #00afff; font-size: 20px;">设备责任人信息</p>
          </el-divider>
        </el-header>
        <el-main>
            <!--第7行-->
            <el-row>

              <el-col :span="8">
                <el-form-item label="责任人" prop="dutyOfficer" label-width="30%">
                  <el-input v-model="form.dutyOfficer" placeholder="请输入责任人" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
        <el-form-item label="责任开始时间" prop="dutyStartTime" label-width="30%">
          <el-date-picker clearable
            v-model="form.dutyStartTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择责任开始时间" style="width:90%;float:left">
          </el-date-picker>
<!--          <el-date-picker-->
<!--            clearable-->
<!--            v-model="form.dutyStartTime"-->
<!--            type="daterange"-->
<!--            range-separator="至"-->
<!--            start-placeholder="开始日期"-->
<!--            end-placeholder="结束日期" style="width:90%;float:left">-->
<!--          </el-date-picker>-->
        </el-form-item>
              </el-col>

              <el-col :span="8">



                <el-form-item label="责任结束时间" prop="dutyEndTime" label-width="30%">
                  <el-date-picker clearable
                                  v-model="form.dutyEndTime"
                                  type="date"
                                  value-format="yyyy-MM-dd"
                                  placeholder="请选择责任结束时间" style="width:90%;float:left">
                  </el-date-picker>
                  <!--          <el-date-picker-->
                  <!--            clearable-->
                  <!--            v-model="form.dutyStartTime"-->
                  <!--            type="daterange"-->
                  <!--            range-separator="至"-->
                  <!--            start-placeholder="开始日期"-->
                  <!--            end-placeholder="结束日期" style="width:90%;float:left">-->
                  <!--          </el-date-picker>-->
                </el-form-item>
              </el-col>


            </el-row>




            <!--第10行-->
            <el-row>




              <el-col :span="8">
                <el-form-item label="审批领导" prop="changeLeadership" label-width="30%">
                  <el-input v-model="form.changeLeadership" placeholder="请输入审批领导(责任人变更登记)" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
        <el-form-item label="审批领导建议" prop="leadershipSuggestions" label-width="30%">
          <el-input v-model="form.leadershipSuggestions" placeholder="请输入审批领导建议" style="width:90%;float:left"/>
        </el-form-item>
              </el-col>
            </el-row>







          <el-row>
            <el-col :span="24">
              <el-form-item label="责任人意见" prop="dutyOfficerOpinion" label-width="10%">
                <el-input v-model="form.dutyOfficerOpinion" placeholder="请输入责任人意见" style="width:97.5%;float:left"/>
              </el-form-item>
            </el-col>
          </el-row>



          </el-main>
        </el-container>


        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">设备维修信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <!--第8行-->
            <el-row>
              <el-col :span="8">
                <el-form-item label="故障原因" prop="faultCause" label-width="30%">
                  <el-input v-model="form.faultCause" placeholder="请输入故障原因" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="报修人" prop="repairMan" label-width="30%">
                  <el-input v-model="form.repairMan" placeholder="请输入报修人" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="处理结果" prop="handlingResult" label-width="30%">
                  <el-input v-model="form.handlingResult" placeholder="请输入处理结果" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>
            </el-row>

            <!--第9行-->
            <el-row>

              <el-col :span="8">
                <el-form-item label="存放地点" prop="storagePlace" label-width="30%">
                  <el-input v-model="form.storagePlace" placeholder="请输入存放地点" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="经办人" prop="operator" label-width="30%">
                  <el-input v-model="form.operator" placeholder="请输入经办人"  style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="审批领导" prop="maintainLeadership" label-width="30%">
                  <el-input v-model="form.maintainLeadership" placeholder="请输入审批领导(故障维修登记)" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>


            </el-row>


          </el-main>
        </el-container>




        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">设备报废信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-row>
            <el-col :span="8">
              <el-form-item label="报废日期" prop="retirementTime" label-width="30%">
                <el-date-picker clearable
                                v-model="form.retirementTime"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="请选择报废日期"
                                style="width:90%;float:left">
                </el-date-picker>
              </el-form-item>
            </el-col>




              <el-col :span="8">
                <el-form-item label="管理人" prop="custodian" label-width="30%">
                  <el-input v-model="form.custodian" placeholder="请输入管理人" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
            <el-col :span="24">
              <el-form-item label="报废原因" prop="discardReason" label-width="10%">
                <el-input v-model="form.discardReason" type="textarea" placeholder="请输入内容" style="width:97.5%;float:left"/>
              </el-form-item>
            </el-col>
            </el-row>
            <!--第11行-->
            <el-row>

              <el-col :span="8">
                <el-form-item label="送销日期" prop="sendDate" label-width="30%">
                  <el-date-picker clearable
                                  v-model="form.sendDate"
                                  type="date"
                                  value-format="yyyy-MM-dd"
                                  placeholder="请选择送销日期"
                                  style="width:90%;float:left">
                  </el-date-picker>
                </el-form-item>
              </el-col>


              <el-col :span="8">
                <el-form-item label="送销地点" prop="sendLocation" label-width="30%">
                  <el-input v-model="form.sendLocation" placeholder="请输入送销地点" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>



            <el-col :span="8">
              <el-form-item label="送销人" prop="sendPeople" label-width="30%">
                <el-input v-model="form.sendPeople" placeholder="请输入送销人" style="width:90%;float:left"/>
              </el-form-item>
            </el-col>
            </el-row>
            <!--第12行-->
            <el-row>

              <el-col :span="8">
                <el-form-item label="监销人" prop="salePeople" label-width="30%">
                  <el-input v-model="form.salePeople" placeholder="请输入监销人" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>
            </el-row>


          </el-main>
        </el-container>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!--=======================================================================================-->


    <!-- 添加或修改办公设备对话框 -->
    <el-dialog :title="view.title" :visible.sync="view.open" width="1300px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">个人基本信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <!--第一行-->
            <el-row>
              <el-col :span="8">
                <el-form-item label="姓名" prop="username" label-width="30%">
                  <el-input v-model="form.username" placeholder="请输入姓名" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="证件编号" prop="certificateId" label-width="30%">
                  <el-input v-model="form.certificateId" placeholder="请输入证件编号" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="身份证号" prop="idNumber" label-width="30%">
                  <el-input v-model="form.idNumber" placeholder="请输入身份证号" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>
            </el-row>

            <!--第2行-->
            <el-row>
              <el-col :span="8">
                <el-form-item label="部门" prop="deptId" label-width="30%">
<!--                  <el-select v-model="form.deptid" placeholder="请选择部门" style="width:90%;float:left" disabled="true">-->
<!--                    <el-option-->
<!--                      v-for="dict in dict.type.yh_deptid"-->
<!--                      :key="dict.value"-->
<!--                      :label="dict.label"-->
<!--                      :value="dict.value"-->
<!--                    ></el-option>-->
<!--                  </el-select>-->
                  <treeselect v-model="form.deptid" :options="deptOptions" :show-count="true" placeholder="请选择部门" disabled="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="单位" prop="department" label-width="30%">
                  <el-input v-model="form.department" placeholder="请输入单位" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="电话" prop="phone" label-width="30%">
                  <el-input v-model="form.phone" placeholder="请输入电话" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

            </el-row>


          </el-main>
        </el-container>

        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">设备基本信息</p>
            </el-divider>
          </el-header>
          <el-main>


            <!--第3行-->
            <el-row>


              <el-col :span="8">
                <el-form-item label="类型" prop="equipType" label-width="30%">
                  <el-input v-model="form.equipType" placeholder="请输入类型" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="来源" prop="equipSource" label-width="30%">
                  <el-input v-model="form.equipSource" placeholder="请输入来源" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="编号" prop="serialNumber" label-width="30%">
                  <el-input v-model="form.serialNumber" placeholder="请输入编号" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>
            </el-row>
            <!--第4行-->
            <el-row>
              <el-col :span="8">
                <el-form-item label="M级" prop="equipSecurity" label-width="30%">
                  <el-select v-model="form.equipSecurity" placeholder="请选择菜单" disabled="true" style="width:90%;float:left" clearable>
                    <el-option
                      v-for="dict in dict.type.yh_security"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="启用时间" prop="activeTime" label-width="30%">
<!--                  <el-input v-model="form.activeTime" placeholder="请输入启用时间" readonly="true" style="width:90%;float:left"/>-->
                  <el-date-picker clearable
                                  v-model="form.activeTime"
                                  type="date"
                                  value-format="yyyy-MM-dd"
                                  placeholder="请选择启用时间"
                                  readonly="true"
                                  style="width:90%;float:left">
                  </el-date-picker>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="硬件编码" prop="hardwareCode" label-width="30%">
                  <el-input v-model="form.hardwareCode" placeholder="请输入硬件编码" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>
            </el-row>

            <!--第5行-->
            <el-row>
              <el-col :span="8">
                <el-form-item label="硬盘序列号" prop="identificationOfHardDisk" label-width="30%">
                  <el-input v-model="form.identificationOfHardDisk" placeholder="请输入硬盘序列号" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="BM防护系统情况" prop="installation" label-width="30%">
                  <el-input v-model="form.installation" placeholder="请输入安全BM防护系统安装情况" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="主要通途" prop="mainThoroughfare" label-width="30%">
                  <el-input v-model="form.mainThoroughfare" placeholder="请输入主要通途" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>
            </el-row>

            <!--第6行-->
            <el-row>

              <el-col :span="8">
                <el-form-item label="承办人" prop="undertaker" label-width="30%">
                  <el-input v-model="form.undertaker" placeholder="请输入承办人" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>


              <el-col :span="8">
                <el-form-item label="日期" prop="changeDate" label-width="30%">
                  <el-date-picker clearable
                                  v-model="form.changeDate"
                                  type="date"
                                  value-format="yyyy-MM-dd"
                                  placeholder="请选择日期"
                                  readonly="true"
                                  style="width:90%;float:left">
                  </el-date-picker>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="品牌类型" prop="brandType" label-width="30%">
                  <el-input v-model="form.note" placeholder="请输入品牌类型" readonly="true" style="width:90%;float:left"/>
                </el-form-item>
              </el-col>


            </el-row>

          </el-main>
        </el-container>

        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff; font-size: 20px;">设备使用信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <!--第7行-->
            <el-row>

              <el-col :span="8">
                <el-form-item label="责任人" prop="dutyOfficer" label-width="30%">
                  <el-input v-model="form.dutyOfficer" placeholder="请输入责任人"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="责任起止时间" prop="dutyStartTime" label-width="30%">
                  <el-date-picker clearable
                                  v-model="form.dutyStartTime"
                                  type="date"
                                  value-format="yyyy-MM-dd"
                                  placeholder="请选择责任起止时间"
                                  style="width:90%;float:left"
                                  readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="责任人意见" prop="dutyOfficerOpinion" label-width="30%">
                  <el-input v-model="form.dutyOfficerOpinion" placeholder="请输入责任人意见"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>


            </el-row>

            <!--第8行-->
            <el-row>
              <el-col :span="8">
                <el-form-item label="故障原因" prop="faultCause" label-width="30%">
                  <el-input v-model="form.faultCause" placeholder="请输入故障原因"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="报修人" prop="repairMan" label-width="30%">
                  <el-input v-model="form.repairMan" placeholder="请输入报修人"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="处理结果" prop="handlingResult" label-width="30%">
                  <el-input v-model="form.handlingResult" placeholder="请输入处理结果"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>
            </el-row>

            <!--第9行-->
            <el-row>
              <el-col :span="8">
                <el-form-item label="经办人" prop="operator" label-width="30%">
                  <el-input v-model="form.operator" placeholder="请输入经办人"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="审批领导" prop="maintainLeadership" label-width="30%">
                  <el-input v-model="form.maintainLeadership" placeholder="请输入审批领导(故障维修登记)"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="报废原因" prop="discardReason" label-width="30%">
                  <el-input v-model="form.discardReason" type="textarea" placeholder="请输入内容"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>
            </el-row>

            <!--第10行-->
            <el-row>
              <el-col :span="8">
                <el-form-item label="报废日期" prop="retirementTime" label-width="30%">
                  <el-date-picker clearable
                                  v-model="form.retirementTime"
                                  type="date"
                                  value-format="yyyy-MM-dd"
                                  placeholder="请选择报废日期"
                                  style="width:90%;float:left"
                                  readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>



              <el-col :span="8">
                <el-form-item label="审批领导" prop="changeLeadership" label-width="30%">
                  <el-input v-model="form.changeLeadership" placeholder="请输入审批领导(责任人变更登记)"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="审批领导建议" prop="leadershipSuggestions" label-width="30%">
                  <el-input v-model="form.leadershipSuggestions" placeholder="请输入审批领导建议"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>
            </el-row>

            <!--第11行-->
            <el-row>
              <el-col :span="8">
                <el-form-item label="存放地点" prop="storagePlace" label-width="30%">
                  <el-input v-model="form.storagePlace" placeholder="请输入存放地点"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="管理人" prop="custodian" label-width="30%">
                  <el-input v-model="form.custodian" placeholder="请输入管理人"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="送销地点" prop="sendLocation" label-width="30%">
                  <el-input v-model="form.sendLocation" placeholder="请输入送销地点"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>
            </el-row>


            <!--第12行-->
            <el-row>
              <el-col :span="8">
                <el-form-item label="送销日期" prop="sendDate" label-width="30%">
                  <el-date-picker clearable
                                  v-model="form.sendDate"
                                  type="date"
                                  value-format="yyyy-MM-dd"
                                  placeholder="请选择送销日期"
                                  style="width:90%;float:left"
                                  readonly="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="送销人" prop="sendPeople" label-width="30%">
                  <el-input v-model="form.sendPeople" placeholder="请输入送销人"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="监销人" prop="salePeople" label-width="30%">
                  <el-input v-model="form.salePeople" placeholder="请输入监销人"  style="width:90%;float:left" readonly="true"/>
                </el-form-item>
              </el-col>
            </el-row>

          <el-row>
            <el-col :span="24">
            <el-form-item label="备注" prop="remark" label-width="10%">
              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"  style="width:97.5%;float:left" readonly="true"/>
            </el-form-item>
            </el-col>
          </el-row>
          </el-main>
        </el-container>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="viewCancel">取 消</el-button>
      </div>
    </el-dialog>

  </div>
</template>


<style>
  .el-header, .el-footer {
    background-color: #FFFFFF;
    color: #333;
    text-align: left;
    line-height: 60px;
    font-style: oblique;

  }

  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
  }

  .el-main {
    background-color: #FFFFFF;
    color: #333;
    text-align: center;
    line-height: 160px;
  }

  body > .el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }

  .el-dialog__title {
    /*color: #1ab394;*/
    font-weight: bold;
    font-size: 25px;
  }
  .input_text{
    background-color: #efefef;
    border-color: #efefef;
    border-style:solid;
    border-top-width:0px;
    border-right-width:0px;
    border-bottom-width:1px;
    border-left-width:0px;

    /*border-top-width: 0px;*/
    /*border-left-width: 0px;*/
    /*border-right-width: 0px;*/
    /*border-bottom-width: 1px;*/
  }
</style>

<script>
import { getToken } from "@/utils/auth";
import { listArchives, getArchives, delArchives, addArchives, updateArchives } from "@/api/module/ls/archives";
import {treeselect} from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {listBaseinfo} from "@/api/module/ls/baseinfo";
export default {
  name: "Archives",
  components: { Treeselect },
  dicts: ['yh_security',
    'yh_deptid'
  ],
  data() {
    return {

      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      //部门树选择
      deptOptions: undefined,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: false,
      // 总条数
      total: 0,
      // 办公设备表格数据
      archivesList: [],
      // 基础信息表格数据
      baseInfoList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        username: null,
        certificateId: null,
        idNumber: null,
        deptid: null,
        department: null,
        undertaker: null,
        phone: null,
        equipType: null,
        equipSource: null,
        serialNumber: null,
        equipSecurity: null,
        activeTime: null,
        brandType: null,
        hardwareCode: null,
        identificationOfHardDisk: null,
        installation: null,
        mainThoroughfare: null,
        note: null,
        sequenceNumber: null,
        dutyOfficer: null,
        dutyStartTime: null,
        changeLeadership: null,
        changeDate: null,
        faultCause: null,
        repairMan: null,
        handlingResult: null,
        operator: null,
        maintainLeadership: null,
        discardReason: null,
        retirementTime: null,
        dutyOfficerOpinion: null,
        leadershipSuggestions: null,
        storagePlace: null,
        custodian: null,
        sendLocation: null,
        sendDate: null,
        sendPeople: null,
        salePeople: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      // 用户查询参数
      view:{
        // 是否显示弹出层（用户查询）
        open: false,
        // 弹出层标题（用户查询）
        title: "",
      },
      // 列信息
      columns: [
        {key: 0, label: `姓名`, visible: true},
        {key: 1, label: `证件编号`, visible: true},
        {key: 2, label: `身份证号`, visible: false},
        {key: 3, label: `部门`, visible: false},
        {key: 4, label: `单位`, visible: false},
        {key: 5, label: `承办人`, visible: true},
        {key: 6, label: `电话`, visible: true},
        {key: 7, label: `类型`, visible: true},
        {key: 8, label: `来源`, visible: false},
        {key: 9, label: `编号`, visible: false},
        {key: 10, label: `M级`, visible: false},
        {key: 11, label: `启用时间`, visible: false},
        {key: 12, label: `品牌类型`, visible: false},
        {key: 13, label: `硬件编码`, visible: false},
        {key: 14, label: `硬盘序列号`, visible: false},
        {key: 15, label: `安全BM防护系统安装情况`, visible: false},
        {key: 16, label: `主要通道`, visible: false},
        {key: 17, label: `品牌类型`, visible: false},
        {key: 18, label: `类型`, visible: false},
        {key: 19, label: `责任人`, visible: false},
        {key: 20, label: `责任开始时间`, visible: false},
        {key: 21, label: `审批领导`, visible: false},
        {key: 22, label: `日期`, visible: false},
        {key: 23, label: `故障原因`, visible: false},
        {key: 24, label: `报修人`, visible: false},
        {key: 25, label: `处理结果`, visible: false},
        {key: 26, label: `经办人`, visible: false},
        {key: 27, label: `审批领导`, visible: false},
        {key: 28, label: `报废原因`, visible: false},
        {key: 29, label: `报废日期`, visible: false},
        {key: 30, label: `责任人意见`, visible: false},
        {key: 31, label: `审批领导建议`, visible: false},
        {key: 32, label: `存放地点`, visible: false},
        {key: 33, label: `管理人`, visible: false},
        {key: 34, label: `送销地点`, visible: false},
        {key: 35, label: `送销日期`, visible: false},
        {key: 36, label: `送销人`, visible: false},
        {key: 37, label: `监销人`, visible: false},
        {key: 38, label: `创建者`, visible: false},
        {key: 39, label: `创建时间`, visible: false},
        {key: 40, label: `更新者`, visible: false},
        {key: 41, label: `更新时间`, visible: false},
        {key: 42, label: `备注`, visible: false},
        {key: 43, label: `责任结束时间`, visible: false}
      ],
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        certificateId: [
          { required: true, message: "证件编号不能为空", trigger: "blur" },
        ],
        idNumber: [
          { required: true, message: "身份证号不能为空", trigger: "blur" },
        ],
        deptid: [
          { required: true, message: "部门不能为空", trigger: "blur" },
        ],
        username: [
          { required: true, message: "姓名不能为空", trigger: "blur" },
        ],
      },
      // 用户导入参数
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/ls/archives/importData"
      }
    };
  },
  created() {
    this.getBaseInfo();
    this.getList();
    this.getTreeselect();
  },
  methods: {
    //下拉列表获取所有用户基本信息
    getBaseInfo() {
      listBaseinfo().then(response => {
        this.baseInfoList = response.rows;
        console.log('baseInfoList '+this.baseInfoList)
      });
    },
    //queryString 为在框中输入的值
    //cb 回调函数，将处理好的数据推回
    querySearchAsync(queryString, cb) {
      //因为autocomplete只识别value字段,所以用replace(/需要用的字段/g,"value")，将需要用的字段全部替换成value
      //(/***/g 是全部替换，如果不用全部替换，可以参考https://www.w3school.com.cn/jsref/jsref_replace.asp)
      let baseInfoJson= JSON.parse(JSON.stringify(this.baseInfoList).replace(/username/g,"value"));
      console.log('baseInfoJson '+baseInfoJson)
      let results = queryString ? baseInfoJson.filter(this.createStateFilter(queryString)) : baseInfoJson;
      console.log('results '+results)
      clearTimeout(this.timeout);
      this.timeout = setTimeout(() => {
        cb(results);
      }, 0.5*1000);
    },
    //根据输入的字段进行筛选
    createStateFilter(queryString) {
      return (state) => {
        return (state.value.toString().toLowerCase().indexOf(queryString.toLowerCase()) === 0);
      };
    },

    //将其他数据自动补全，采用覆盖的方法
    handleSelect(item){
      this.form.username = item.value;
      this.form.idNumber=item.idNumber;
      this.form.certificateId=item.certificateId;
      this.form.deptId = item.deptId;
    },
    getTreeselect(){
      treeselect().then(response => {
        this.deptOptions = response.data;
      });
    },
    /** 查询办公设备列表 */
    getList() {
      this.loading = true;
      listArchives(this.queryParams).then(response => {
        this.archivesList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 取消按钮
    viewCancel() {
      this.view.open = false;
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        username: null,
        certificateId: null,
        idNumber: null,
        deptid: null,
        department: null,
        undertaker: null,
        phone: null,
        equipType: null,
        equipSource: null,
        serialNumber: null,
        equipSecurity: null,
        activeTime: null,
        brandType: null,
        hardwareCode: null,
        identificationOfHardDisk: null,
        installation: null,
        mainThoroughfare: null,
        note: null,
        sequenceNumber: null,
        dutyOfficer: null,
        dutyStartTime: null,
        dutyEndTime: null,
        changeLeadership: null,
        changeDate: null,
        faultCause: null,
        repairMan: null,
        handlingResult: null,
        operator: null,
        maintainLeadership: null,
        discardReason: null,
        retirementTime: null,
        dutyOfficerOpinion: null,
        leadershipSuggestions: null,
        storagePlace: null,
        custodian: null,
        sendLocation: null,
        sendDate: null,
        sendPeople: null,
        salePeople: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,

        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      };
      this.resetForm("form");
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download('/ls/archives/importTemplate', {
      }, `user_template_${new Date().getTime()}.xlsx`)
    },
    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = "用户导入";
      this.upload.open = true;
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
      this.getList();
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    indexMethod(index) {
      index = (index + 1) + (this.queryParams.pageNum - 1) * this.queryParams.pageSize
      return index
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加办公设备";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getArchives(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改办公设备";
      });
    },
    /** 详细按钮操作 */
    handleView(row) {
      // const id = row.id || this.ids
      // getArchives(id).then(response => {
      //   this.form = response.data;
      //   this.view.open = true;
      //   this.view.title = "办公设备信息查看";
      // });
      const id = row.id;
      this.$router.push({ path:"/jiben/archives_detail", query: {id}});
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateArchives(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addArchives(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除办公设备编号为"' + ids + '"的数据项？').then(function() {
        return delArchives(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },

    /** 导出按钮操作 */
    handleExport() {
      this.download('system/archives/export', {
        ...this.queryParams
      }, `archives_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
